<%@page import="helpers.DateHelper"%>
<%@page import="helpers.StringHelper"%>
<%@page import="models.CooperationModel"%>
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="helpers.PaginatorHelper"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="java.util.ArrayList"%>
<%
ArrayList<CooperationModel> cooperations = (ArrayList<CooperationModel>) request.getAttribute("cooperations");
int pages = (Integer) request.getAttribute("page");
boolean nextPage = (Boolean) request.getAttribute("nextPage");
boolean prevPage = (Boolean) request.getAttribute("prevPage");
PaginatorHelper paginator = (PaginatorHelper) request.getAttribute("paginator");
%>

<jsp:include page="/admin/layouts/header.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>

<script type="text/javascript" src="/admin/js/list_cooperation.js"></script>
<script type="text/javascript" src="/admin/js/list_form.js"></script>
<script type="text/javascript">
<!--
var server = "<%=UrlHelper.getServerUrl(request)%>";
//-->
</script>
        <div class="maincontent noright">
        	<div class="maincontentinner">
            	
                <ul class="maintabmenu">
                	<li class="current"><a href="/admin/dashboard">Liên hệ hợp tác</a></li>
                </ul><!--maintabmenu-->
                
                <div class="content">
                	<div class="contenttitle radiusbottom0">
	                	<h2 class="table"><span>Liên hệ hợp tác</span></h2>
	                </div>
	                
	                <!-- <div class="tableoptions">
	                    <select class="radius3 action-value">
	                        <option value="delete">Xoá các mục đã chọn</option>
	                    </select> &nbsp;
	                    <button class="radius3 apply-change">Apply</button>
	                </div>
	                 -->
	                <table cellspacing="0" cellpadding="0" border="0" class="stdtable stdtablecb" id="list-table">
	                    <colgroup>
	                        <col class="con0">
	                        <col class="con1">
	                        <col class="con0">
	                        <col class="con1">
	                        <col class="con0">
	                        <col class="con1">
	                        <col class="con0">
	                    </colgroup>
	                    <thead>
	                        <tr>
	                        	<th class="head0"><span class="checkbox"><input type="checkbox" class="checkall"></span></th>
	                            <th class="head1">Tên</th>
	                            <th class="head0">Mobile</th>
	                            <th class="head1">Email</th>
	                            <th class="head0">Công ty</th>
	                            <th class="head1">Địa chỉ</th>
	                            <th class="head0">Nội dung</th>
	                            <th class="head1">Ngày gửi</th>
	                            <th class="head0">Action</th>
	                        </tr>
	                    </thead>
	                    <tfoot>
	                        <tr>
	                        	<th class="head0"><span class="checkbox"><input type="checkbox" class="checkall"></span></th>
	                            <th class="head1">Tên</th>
	                            <th class="head0">Mobile</th>
	                            <th class="head1">Email</th>
	                            <th class="head0">Công ty</th>
	                            <th class="head1">Địa chỉ</th>
	                            <th class="head0">Nội dung</th>
	                            <th class="head1">Ngày gửi</th>
	                            <th class="head0">Action</th>
	                        </tr>
	                    </tfoot>
	                    <tbody>
	                    	<% for (int i = 0; i < cooperations.size(); i++) { %>
	                        <tr>
	                        	<td class="center"><span class="checkbox"><input type="checkbox" value="<%=cooperations.get(i).getId()%>"></span></td>
	                            <td><a href="/admin/cooperation/read/<%=cooperations.get(i).getId()%>"><%=cooperations.get(i).getName() %></a></td>
	                            <td class="center"><%=cooperations.get(i).getPhone() %></td>
	                            <td class="center"><%=cooperations.get(i).getEmail() %></td>
	                            <td class="center"><%=cooperations.get(i).getCompany() %></td>
	                            <td class="center"><%=cooperations.get(i).getAddress() %></td>
	                            <td><%=StringHelper.cutString(cooperations.get(i).getContent(), 25)%></td>
	                            <td class="center"><%=DateHelper.dateToString(cooperations.get(i).getCreated(), "dd-MM-yyyy") %></td>
	                            <td class="center">
	                            	<a title="Xem tin" href="/admin/cooperation/read/<%=cooperations.get(i).getId()%>" class="view">
										Xem
									</a>&nbsp;
									<a title="Xóa tin" href="/admin/cooperation/delete/<%=cooperations.get(i).getId()%>" id="action_del" class="delete">
										Delete
									</a>
								</td>
	                        </tr>
	                        <% } %>
	                    </tbody>
	                </table>
	                <!-- paginate -->
	                <div class="dataTables_paginate paging_full_numbers" id="dyntable_paginate">
	                	<% if (prevPage) { %>
							<a class="previous paginate_button" id="dyntable_previous" href="<%=paginator.getPrev()%>">Previous</a>
						<% } else { %>
							<span class="previous paginate_button paginate_button_disabled" id="dyntable_previous">Previous</span>
						<% } %>
						<% if (nextPage) { %>
							<a class="next paginate_button" id="dyntable_next"  href="<%=paginator.getNext()%>">Next</a>
						<% } else { %>
							<span class="next paginate_button paginate_button_disabled" id="dyntable_next">Next</span>
						<% } %>
	                </div>
                </div><!--content-->
                
            </div><!--maincontentinner-->
            
            <jsp:include page="/admin/elements/copyright.jsp">
            	<jsp:param name="language" value="1" />
			</jsp:include>
            
        </div><!--maincontent-->
        
<jsp:include page="/admin/layouts/footer.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>